home *** CD-ROM | disk | FTP | other *** search
- Path: shell.portal.com!not-for-mail
- From: rfield@shell.portal.com (Field)
- Newsgroups: comp.lang.c++
- Subject: Re: float....question
- Date: 16 Feb 1996 08:04:21 -0800
- Organization: Portal Communications (shell)
- Message-ID: <4g29u5$ovk@jobe.shell.portal.com>
- References: <4f7obh$lej@wumpus.cc.uow.edu.au> <311D6971.6993@cnw.com>
- NNTP-Posting-Host: jobe.shell.portal.com
-
- Mike Robinson <miker@cnw.com> writes:
-
- >PAOPENG THEERADECH wrote:
-
- >>
- >> When I type 5.5 in, I got the output as 5.49999999
- >> The number that i got from that program very close to the number that I just
- >> type in. Anyway, that not the number that I expect to got.
- >>
- >> Could anyone here please kind to tell me what wrong with this?????
- >>
-
-
-
- >I just copied your code into my compiler, and it ran fine. I entered
- >5.5 and it returned 5.5.
-
-
- This will depend on the type of rounding done by the compiler and
- will vary from implementation to implementation, and these kinds of
- problems are common. I have read of compilers (not modern ones) which
- would print out integers as fractions, read 2.0, print 1.99999999.
- So this looks like a bug in the cout implementation.
-